import React from "react";

const Classes = (props) => {
    
    const handleClick = () => {
        // 调用API，往编辑器中插入一个数字
        props.editor.insertText(
            "```mermaid\n" + 
            "classDiagram\n" + 
            "Class01 <|-- AveryLongClass : Cool\n" + 
            "Class03 *-- Class04\n" + 
            "Class05 o-- Class06\n" + 
            "Class07 .. Class08\n" + 
            "Class09 --> C2 : Where am i?\n" + 
            "Class09 --* C3\n" + 
            "Class09 --|> Class07\n" + 
            "Class07 : equals()\n" + 
            "Class07 : Object[] elementData\n" + 
            "Class01 : size()\n" + 
            "Class01 : int chimp\n" + 
            "Class01 : int gorilla\n" + 
            "Class08 <--> C2: Cool label\n" + 
            "```\n\n" + 
            "<p>请参考<a href=\"https://github.com/mermaid-js/mermaid\" target=\"_blank\">mermaid</a>。</p>"
        );
    }

    return (
        <span
        className="button button-type-counter"
        title="类图"
        onClick={handleClick}
        >
        <i className="fa fa-object-group" />
        </span>
    );
}

Classes.align = 'left';
Classes.pluginName = 'classes';

export default Classes;